<style>
    .form-copy {
        margin-right: 5px;
        border-radius: 0;
        box-shadow: none;
        padding: 4px 12px 7px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        border: 1px solid #ccc;
        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    }
    .select2 {
        margin-right: 5px
    }
</style>

<div class="btn-group" style="padding-top: 10px;padding-right: 5px;">
    <a class="btn btn-sm btn-default">  {{ trans('admin.action') }}</a>
    <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
    </button>
    <ul class="dropdown-menu" role="menu">
        <li><a href="#" class="grid-batch-1">批量启用</a></li>
        <li><a href="#" class="grid-batch-2">批量停用</a></li>
    </ul>
</div>

<div class="btn-group" style="margin-right: 10px; margin-top: 10px;">
    <form action="{{ $action }}" pjax-container method="get">
        <input type="text" class="form-copy" name="sku" value="{{ $filtersBlade['sku'] }}" placeholder="SKU信息">
        <select id="classify_id" name="classify_id">
            {{ $filtersBlade['classify_id'] }}
        </select>
        <select id="status" name="status">
            {{ $filtersBlade['status'] }}
        </select>
         <button class="btn btn-sm btn-info submit"><i class="fa fa-search"></i>&nbsp;&nbsp;{{ trans('admin.search') }}</button>
        <a style="margin-left: 10px;" href="{{ $action }}" class="btn btn-sm btn-default"><i class="fa fa-undo"></i>&nbsp;&nbsp;{{ trans('admin.reset') }}</a>
    </form>
</div>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $('#status').select2({placeholder: '申请状态', allowClear: true, width: '150px'});
        $('#classify_id').select2({placeholder: '品类', allowClear: true, width: '150px'});

        $(".grid-batch-1").click(function(){
            let chk_value =[];
            $('input[name="pskuid[]"]:checked').each(function(){

                let _this = $(this);
                let id = _this.data('id');
                let psku_id =_this.data('psku-id');
                let classify_id = _this.data('classify-id');

                let data = {
                    amazon_sku_id: id,
                    psku_id: psku_id,
                    classify_id: classify_id,
                };

                chk_value.push(data);
            });

            if (chk_value.length == 0) {
                swal('请选择数据', '', 'error');
                return false;
            }
            console.log(chk_value); return;
            $.ajax({
                method: 'post',
                url: '/xqc/products/sku-review-ajax',
                data: {
                    _token: "{{ csrf_token() }}",
                    action: 'updateSkuStatus',
                     param: chk_value,
                },
                success: function (data) {
                    $.pjax.reload('#pjax-container');
                    toastr.success(data.message);
                },
                error: function () {
                    swal(data.message, '', 'error');
                }
            });
        })

    });
</script>

